<template>
	<view class="container">
		<!-- 药品组合列表区域 -->
		<view class="group-list">
			<view class="group-item" v-for="(group, index) in groupList" :key="index">
				<view class="group-info">
					<text class="group-name">{{group.name}}</text>
					<text class="group-medicines">{{group.medicines.join(', ')}}</text>
				</view>
				<view class="group-detail">
					<button class="detail-btn" size="mini" plain @click="navigateToEdit(group.id)">详情</button>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	// import { useGroupStore } from '@/store/group'
	// const groupStore = useGroupStore()
	export default {
		setup(){
			return{
				// groupStore
			}
		},
		data() {
			return {
				groupList: []
			}
		},
		onLoad(){
			// groupStore.getAllGroupById()
			// // return
			// this.groupList = groupStore.Groups
		},
		methods: {
			// 跳转到编辑页面
			navigateToEdit(id) {
				// 跳转到编辑页面
				uni.navigateTo({
					url: `/pages/group/groupDetail?id=${id}`
				})
			}
		}
	}
</script>

<style lang="scss">
.container {
	padding: 20rpx;
	background-color: #f5f5f5;
	min-height: 100vh;
}

// 药品组合列表区域样式
.group-list {
	background-color: #ffffff;
	border-radius: 16rpx;
	padding: 20rpx;
	box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
	
	.group-item {
		display: flex;
		align-items: center;
		padding: 20rpx;
		border-bottom: 1rpx solid #f5f5f5;
		
		&:last-child {
			border-bottom: none;
		}
		
		.group-info {
			flex: 1;
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			
			.group-name {
				font-size: 28rpx;
				color: #333;
				margin-bottom: 16rpx;
			}
			
			.group-medicines {
				font-size: 24rpx;
				color: #666;
				overflow: hidden;
				text-overflow: ellipsis;
				white-space: nowrap;
			}
		}
		
		.group-detail {
			.detail-btn {
				font-size: 24rpx;
				color: #2ac2d1;
				border-color: #2ac2d1;
				
				&::after {
					border-color: #2ac2d1;
				}
			}
		}
	}
}
</style> 